from django.db import models

# Create your models here.

#用户类
class User(models.Model):
    #用户名
    uname = models.CharField(max_length=20,unique=True)
    #用户密码
    upwd = models.CharField(max_length=32)
    #用户头像
    uicon = models.ImageField(null=True,blank=True,default=None)

    def __str__(self):
        return self.uname


#博客类
class Blogs(models.Model):
    #博文标题
    title = models.CharField(max_length=32,)
    #博文内容
    content = models.TextField()
    #博文创建时间
    btime = models.DateTimeField(auto_now_add=True)
    #博文与用户关系(一对多)
    blog_user = models.ForeignKey(User)
